package com.example.androidproject.net;

import com.example.androidproject.data.request.ArticleWrapper;
import com.example.androidproject.data.request.LoginRequest;
import com.example.androidproject.data.response.LoginResponse;

import java.util.Map;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.Query;

public interface IdeaApiService {

    @GET("article/list/0/json")
    Observable<ArticleWrapper> getArticle();

    @GET("https://test-shop.ruichat.net:24180/api/mock/shop/store/initDict.html")
//    @GET("http://op.juhe.cn/onebox/weather/query")
    Observable<String> getTest();

    @GET("userdomain/userservice/usermodule/v1/users/queryUser")
    Observable<String> queryUser(@Query("uid") String uid);

    /**
     * 登录 appId secret
     * 使用实体类作为参数
     */
    @POST("user/login")
    Observable<LoginResponse> login(@Body LoginRequest request);

    @POST("user/login")
    @FormUrlEncoded
    Observable<LoginResponse> login(@Field("username") String username,@Field("password") String password);

    /**
     * 使用map作为参数
     */
    @FormUrlEncoded
    @POST("user/login")
    Observable<LoginResponse> login(@FieldMap Map<String, Object> map);

    //上传图片
    @Multipart
    @POST("userdomain/userservice/users/upload")
    Observable<String> uploadImg(@Part MultipartBody.Part imageFile);

    @POST("mini/list/{phoneNumber}")
    @FormUrlEncoded
    Observable<String> test1(@Path("phoneNumber") String phoneNumber);

    @Headers({"Content-Type: application/json","Accept: application/json"})
    @POST("userdomain/userservice/authResult")
    Observable<String> authResult(@Body RequestBody body);
}
